import { uid } from "uid"; 
import {FlowNodeType} from "../types/index";
import type {FlowNodePropsType,FlowNodeFormConfigType} from "../types/index";
export default class BaseFlowNode {
  // 节点id
  private id: String = 'node_'+uid(32); 

   // 节点名称
  private name: String = '';

   // 节点类型
  private type: FlowNodeType;

   // 节点属性 传递给节点的参数
  private props: FlowNodePropsType = {
    header: {
      icon: '',
      title: '',
      bgColor: 'white',
      color:'',
    },
    description: '',
  }; 

//节点打开的表单配置属性
 private  formProps:FlowNodeFormConfigType = {};

 constructor(name:String, type: FlowNodeType, props: FlowNodePropsType, formProps: FlowNodeFormConfigType) {
  this.name = name;
  this.type = type;
  this.props = props;
  this.formProps = formProps; 
 }

 getNodeId(): String {
  return this.id;
}
getNodeName(): String {
  return this.name;
  }

  getNodeType(): FlowNodeType {
    return this.type;
    } 

    getNodeProps(): FlowNodePropsType {
      return this.props;
      
    }

    getNodeFormProps(): FlowNodeFormConfigType {
      return this.formProps;
    }

    setNodeProps(props: FlowNodePropsType): void {
      this.props = props;
    }

    setNodeFormProps(formProps: FlowNodeFormConfigType): void {
      this.formProps = formProps;
    }


}